import { h } from "vue";
import k8sId from "@/views/containerSystem/k8s/k8sId.vue";
import k8sState from "@/views/containerSystem/k8s/k8sState.vue";

export const k8sColumns = [
  {
    title: "名称",
    slotName: "serviceName",
    width: 100,
    render: ({ record }) => h(k8sId, { record }),
  },
  {
    title: "状态",
    slotName: "state",
    width: 60,
    render: ({ record }) => h(k8sState, { record }),
    filterable: {
      filters: [
        {
          text: "正常",
          value: 0,
        },
        {
          text: "异常",
          value: 1,
        },
      ],
      filter: (value, record) => record.state.includes(value),
    },
  },
  {
    title: "所属集群",
    dataIndex: "masterIp",
    width: 150,
  },
  {
    title: "命名空间",
    dataIndex: "namespace",
    width: 120,
  },
  {
    title: "工作负载",
    dataIndex: "workload",
    width: 120,
  },
  {
    title: "服务地址",
    dataIndex: "serviceIp",
    width: 120,
  },
  {
    title: "端点数",
    dataIndex: "endPoint",
    width: 80,
  },
  {
    title: "关联POD数",
    dataIndex: "podCount",
    width: 80,
  },
  {
    title: "运行时间",
    dataIndex: "runTime",
    width: 80,
  },
];

export const podColumns = [
  {
    title: "名称",
    slotName: "podName",
    width: 100,
    // render: ({ record }) => h(k8sId, { record }),
  },
  {
    title: "状态",
    slotName: "state",
    width: 60,
    // render: ({ record }) => h(k8sState, { record }),
    // filterable: {
    //   filters: [
    //     {
    //       text: "正常",
    //       value: 0,
    //     },
    //     {
    //       text: "异常",
    //       value: 1,
    //     },
    //   ],
    //   filter: (value, record) => record.state.includes(value),
    // },
  },
  {
    title: "所属集群",
    dataIndex: "masterIp",
    width: 150,
  },
  {
    title: "命名空间",
    dataIndex: "namespace",
    width: 120,
  },
  {
    title: "工作负载",
    dataIndex: "workload",
    width: 120,
  },
  {
    title: "IP地址",
    dataIndex: "serviceIp",
    width: 120,
  },
  {
    title: "运行时间",
    dataIndex: "runTime",
    width: 60,
  },
  {
    title: "容器数",
    dataIndex: "runTime",
    width: 60,
  },
  {
    title: "重启次数",
    dataIndex: "runTime",
    width: 60,
  },
  {
    title: "CPU Request",
    dataIndex: "runTime",
    width: 60,
  },
  {
    title: "CPU Limit",
    dataIndex: "runTime",
    width: 60,
  },
  {
    title: "CPU使用量",
    dataIndex: "runTime",
    width: 60,
  },
  {
    title: "内存 Request",
    dataIndex: "runTime",
    width: 60,
  },
  {
    title: "内存 Limit",
    dataIndex: "runTime",
    width: 60,
  },
  {
    title: "内存使用量",
    dataIndex: "runTime",
    width: 60,
  },
  {
    title: "内存使用量",
    dataIndex: "runTime",
    width: 60,
  },
  {
    title: "磁盘使用量",
    dataIndex: "runTime",
    width: 60,
  },
];
